From 4c6a0c613eeef079a4a53708d5f8a4d8cd9be160 Mon Sep 17 00:00:00 2001 From: robertl Date: Mon, 21 Mar 2005 15:01:04 +0000 Subject: [PATCH] Call waypt_new instead of explicit calloc to prepare for external alt invalid indicator. --- gpsbabel/cetus.c | 2 +- gpsbabel/copilot.c | 2 +- gpsbabel/csv_util.c | 2 +- gpsbabel/geoniche.c | 2 +- gpsbabel/gpspilot.c | 2 +- gpsbabel/gpsutil.c | 2 +- gpsbabel/holux.c | 2 +- gpsbabel/magnav.c | 2 +- gpsbabel/mapopolis.c | 2 +- gpsbabel/mapsend.c | 6 +++--- gpsbabel/pcx.c | 2 +- gpsbabel/psp.c | 2 +- gpsbabel/tiger.c | 2 +- gpsbabel/tmpro.c | 2 +- gpsbabel/tpg.c | 2 +- 15 files changed, 17 insertions(+), 17 deletions(-) diff --git a/gpsbabel/cetus.c b/gpsbabel/cetus.c index 2e462fff2..17927d013 100644 --- a/gpsbabel/cetus.c +++ b/gpsbabel/cetus.c @@ -165,7 +165,7 @@ data_read(void) for(pdb_rec = pdb->rec_index.rec; pdb_rec; pdb_rec=pdb_rec->next) { waypoint *wpt_tmp; - wpt_tmp = xcalloc(sizeof(*wpt_tmp),1); + wpt_tmp = waypt_new(); rec = (struct record *) pdb_rec->data; if ( be_read32(&rec->elevation) == -100000000 ) { diff --git a/gpsbabel/copilot.c b/gpsbabel/copilot.c index d55adb62f..787e5be43 100644 --- a/gpsbabel/copilot.c +++ b/gpsbabel/copilot.c @@ -88,7 +88,7 @@ data_read(void) waypoint *wpt_tmp; char *vdata; - wpt_tmp = xcalloc(sizeof(*wpt_tmp),1); + wpt_tmp = waypt_new(); rec = (struct record *) pdb_rec->data; wpt_tmp->longitude = diff --git a/gpsbabel/csv_util.c b/gpsbabel/csv_util.c index 64ae1edd5..3b4fd2849 100644 --- a/gpsbabel/csv_util.c +++ b/gpsbabel/csv_util.c @@ -782,7 +782,7 @@ xcsv_data_read(void) } if (strlen(buff)) { - wpt_tmp = xcalloc(sizeof(*wpt_tmp), 1); + wpt_tmp = waypt_new(); s = buff; s = csv_lineparse(s, xcsv_file.field_delimiter, "", linecount); diff --git a/gpsbabel/geoniche.c b/gpsbabel/geoniche.c index 69e22e8ca..ff4a5a5d5 100644 --- a/gpsbabel/geoniche.c +++ b/gpsbabel/geoniche.c @@ -216,7 +216,7 @@ data_read(void) char gid[6+1]; struct tm tm; - wpt = xcalloc(sizeof(*wpt), 1); + wpt = waypt_new(); if (!wpt) fatal(MYNAME ": Couldn't allocate waypoint.\n"); vdata = (char *) pdb_rec->data; diff --git a/gpsbabel/gpspilot.c b/gpsbabel/gpspilot.c index 4bc707798..712b0e392 100644 --- a/gpsbabel/gpspilot.c +++ b/gpsbabel/gpspilot.c @@ -122,7 +122,7 @@ data_read(void) waypoint *wpt_tmp; char *vdata; - wpt_tmp = xcalloc(sizeof(*wpt_tmp),1); + wpt_tmp = waypt_new(); rec = (struct record *) pdb_rec->data; wpt_tmp->longitude = be_read32(&rec->longitude) / 3.6e6; diff --git a/gpsbabel/gpsutil.c b/gpsbabel/gpsutil.c index 1a56354b3..4433a7fa1 100644 --- a/gpsbabel/gpsutil.c +++ b/gpsbabel/gpsutil.c @@ -84,7 +84,7 @@ data_read(void) sscanf(&ibuf[70], "%2c", icon); rtrim(desc); rtrim(icon); - wpt_tmp = xcalloc(sizeof(*wpt_tmp),1); + wpt_tmp = waypt_new(); wpt_tmp->altitude = alt; wpt_tmp->shortname = xstrdup(name); wpt_tmp->description = xstrdup(desc); diff --git a/gpsbabel/holux.c b/gpsbabel/holux.c index 5b5d21efb..03613ff7f 100644 --- a/gpsbabel/holux.c +++ b/gpsbabel/holux.c @@ -106,7 +106,7 @@ static void data_read(void) /* Get the waypoints */ for (iCount = 0; iCount < iWptNum ; iCount ++) { - wpt_tmp = xcalloc(sizeof(*wpt_tmp), 1); + wpt_tmp = waypt_new(); iWptIndex = le_read16(&((WPTHDR *)HxWpt)->idx[iCount]); pWptHxTmp = (WPT *)&HxWpt[OFFS_WPT + (sizeof(WPT) * iWptIndex)]; diff --git a/gpsbabel/magnav.c b/gpsbabel/magnav.c index ef9020bfa..bc0a8183a 100644 --- a/gpsbabel/magnav.c +++ b/gpsbabel/magnav.c @@ -106,7 +106,7 @@ data_read(void) struct tm tm; memset (&tm, sizeof(tm), 0); - wpt_tmp = xcalloc(sizeof(*wpt_tmp),1); + wpt_tmp = waypt_new(); rec = (struct record *) pdb_rec->data; wpt_tmp->altitude = be_read32(&rec->elevation); diff --git a/gpsbabel/mapopolis.c b/gpsbabel/mapopolis.c index 6d632831d..55e73bd76 100644 --- a/gpsbabel/mapopolis.c +++ b/gpsbabel/mapopolis.c @@ -157,7 +157,7 @@ decode(char *buf) edata = (char *) rec + pdb_rec->data_len; for (; vdata < edata; rec = (struct record *) vdata) { - wpt_tmp = xcalloc(sizeof(*wpt_tmp),1); + wpt_tmp = waypt_new(); wpt_tmp->latitude = Lat1 + be_read16(&rec->lat1d) / LATDIV2; wpt_tmp->longitude = Lon1 + diff --git a/gpsbabel/mapsend.c b/gpsbabel/mapsend.c index b5c2879a9..0a7062337 100644 --- a/gpsbabel/mapsend.c +++ b/gpsbabel/mapsend.c @@ -125,7 +125,7 @@ mapsend_wpt_read(void) my_fread4(&wpt_count, mapsend_file_in); while (wpt_count--) { - wpt_tmp = xcalloc(sizeof(*wpt_tmp), 1); + wpt_tmp = waypt_new(); if (fread(&scount, sizeof(scount), 1, mapsend_file_in) < 1) { fatal(MYNAME ": out of data reading %d waypoints\n", @@ -183,7 +183,7 @@ mapsend_wpt_read(void) my_fread4(&wpt_count, mapsend_file_in); while (wpt_count--) { - wpt_tmp = xcalloc(sizeof(*wpt_tmp), 1); + wpt_tmp = waypt_new(); /* waypoint name */ fread(&scount, sizeof(scount), 1, mapsend_file_in); @@ -259,7 +259,7 @@ mapsend_track_read(void) centisecs = 0; } - wpt_tmp = xcalloc(sizeof(*wpt_tmp), 1); + wpt_tmp = waypt_new(); wpt_tmp->latitude = -wpt_lat; wpt_tmp->longitude = wpt_long; wpt_tmp->creation_time = time; diff --git a/gpsbabel/pcx.c b/gpsbabel/pcx.c index 27a04ae9b..132c1690d 100644 --- a/gpsbabel/pcx.c +++ b/gpsbabel/pcx.c @@ -94,7 +94,7 @@ data_read(void) &symnum); desc[sizeof(desc)-1] = '\0'; name[sizeof(name)-1] = '\0'; - wpt_tmp = xcalloc(sizeof(*wpt_tmp), 1); + wpt_tmp = waypt_new(); wpt_tmp->altitude = alt; wpt_tmp->shortname = xstrdup(name); wpt_tmp->description = xstrdup(desc); diff --git a/gpsbabel/psp.c b/gpsbabel/psp.c index 3fee4ab8b..c621be61e 100644 --- a/gpsbabel/psp.c +++ b/gpsbabel/psp.c @@ -215,7 +215,7 @@ psp_read(void) pincount = le_read16(&buff[12]); while (pincount--) { - wpt_tmp = xcalloc(sizeof(*wpt_tmp),1); + wpt_tmp = waypt_new(); wpt_tmp->altitude = unknown_alt; diff --git a/gpsbabel/tiger.c b/gpsbabel/tiger.c index f723a8951..b00699f0d 100644 --- a/gpsbabel/tiger.c +++ b/gpsbabel/tiger.c @@ -136,7 +136,7 @@ data_read(void) while (fgets(ibuf, sizeof(ibuf), file_in)) { if( sscanf(ibuf, "%lf,%lf:%100[^:]:%100[^\n]", &lon, &lat, icon, desc)) { - wpt_tmp = xcalloc(sizeof (*wpt_tmp), 1); + wpt_tmp = waypt_new(); wpt_tmp->longitude = lon; wpt_tmp->latitude = lat; diff --git a/gpsbabel/tmpro.c b/gpsbabel/tmpro.c index 708dd9abd..2e1ed9a98 100644 --- a/gpsbabel/tmpro.c +++ b/gpsbabel/tmpro.c @@ -84,7 +84,7 @@ data_read(void) /* skip the line if it contains "sHyperLink" as it is a header (I hope :) */ if ((strlen(buff)) && (strstr(buff, "sHyperLink") == NULL)) { - wpt_tmp = xcalloc(sizeof(*wpt_tmp), 1); + wpt_tmp = waypt_new(); /* data delimited by tabs, not enclosed in quotes. */ s = buff; diff --git a/gpsbabel/tpg.c b/gpsbabel/tpg.c index 9eb3696b5..e12807d86 100644 --- a/gpsbabel/tpg.c +++ b/gpsbabel/tpg.c @@ -135,7 +135,7 @@ tpg_read(void) while (pointcount--) { - wpt_tmp = xcalloc(sizeof(*wpt_tmp),1); + wpt_tmp = waypt_new(); /* 1 bytes at start of record - string size for shortname */ tpg_fread(&buff[0], 1, 1, tpg_file_in); -- 2.30.2